<?php
//error_reporting(0);
$isadmin=1;
require('check.php');
require('../../s/comm/config.php');
require("../common/connect.php");

function check_addslashes($content){
	if(get_magic_quotes_gpc()==0){
	    $content = addslashes($content);
	}
	return $content;
}

$_POST ['content']=check_addslashes($_POST ['content']);

$id=$_POST['id'];
$lm=$_POST['lm'];
$catid=$_POST['cat'];
$catid=implode(",", $catid).",";
$merchant=$_POST['merchant'];
$logo=$_POST['picname'];
$url=$_POST['url'];
$hdfk=$_POST['hdfk'];
$zgfp=$_POST['zgfp'];
$yfzc=$_POST['yfzc'];
$js=$_POST['content'];
$fan=$_POST['fan'];
$name=$_POST['name'];
$des=$_POST['des'];
$client_fx_desc=mysql_real_escape_string($_POST['client_fx_desc']);
$yilink=$_POST['yilink'];
//$chalink=$_POST['chalink'];
$sort=$_POST['sort']?$_POST['sort']:255;
$r_sort=$_POST['sort']?$_POST['r_sort']:0;

if($id=='')
{
	$filed_arr=array('name'=>$name,'merchant'=>$merchant,'url'=>$url,'logo'=>$logo,'catid'=>$catid,'fan'=>$fan,'hdfk'=>$hdfk,'zgfp'=>$zgfp,'yfzc'=>$yfzc,'des'=>$des,'client_fx_desc'=>$client_fx_desc,'js'=>$js,'sort'=>$sort,'recommend_order'=>$r_sort,'yilink'=>$yilink,'lm'=>$lm,'time'=>date('Y-m-d H:i:s'));
    sql_insert_one("mall",$filed_arr);
	$id=mysql_insert_id();
}
else
{
	$filed_arr=array('name'=>$name,'merchant'=>$merchant,'url'=>$url,'logo'=>$logo,'catid'=>$catid,'fan'=>$fan,'hdfk'=>$hdfk,'zgfp'=>$zgfp,'yfzc'=>$yfzc,'des'=>$des,'client_fx_desc'=>$client_fx_desc,'js'=>$js,'sort'=>$sort,'recommend_order'=>$r_sort,'yilink'=>$yilink,'lm'=>$lm);
    sql_update("mall",$filed_arr,"id",$id);
}

?>
<script>
alert('保存成功！');
//history.go(-1);
window.location='mall.php?id=<?PHP echo $id?>';
</script>